<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.trade.ti_voucher.*" %>
<%@page import="java.util.*" %>
<html>
  <head>
    
    <title>优惠券管理管理</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="index.js"></script>
	<script type="text/javascript" src="/js/commen.js"></script>
		<script language="javascript" type="text/javascript" src="/program/plugins/calendar/WdatePicker.js"></script>
</head>

<body>

  <% 
  	String voucher_id="";
  	if(request.getParameter("voucher_id")!=null) voucher_id = request.getParameter("voucher_id");
  	Ti_voucherInfo ti_voucherInfo = new Ti_voucherInfo();
  	List list = ti_voucherInfo.getListByPk(voucher_id);
  	Hashtable map = new Hashtable();
  	if(list!=null && list.size()>0) map = (Hashtable)list.get(0);
  	
  	String voucher_type="",voucher_name="",usage_rules="",start_time="",end_time="",money="",property_type="",state_code="";
  	if(map.get("voucher_type")!=null) voucher_type = map.get("voucher_type").toString();
  	if(map.get("voucher_name")!=null) voucher_name = map.get("voucher_name").toString();
  	if(map.get("usage_rules")!=null) usage_rules = map.get("usage_rules").toString();
  	if(map.get("start_time")!=null) start_time = map.get("start_time").toString();
  	if(map.get("end_time")!=null) end_time = map.get("end_time").toString();
  	if(map.get("state_code")!=null) state_code = map.get("state_code").toString();
  	if(map.get("money")!=null) money = map.get("money").toString();
  	if(map.get("property_type")!=null) property_type = map.get("property_type").toString();
	if(start_time.length()>10)start_time=start_time.substring(0,10);
	if(end_time.length()>10)end_time=end_time.substring(0,10);
	Ti_PaymentRulesInfo ti_paymentruleInfo =new Ti_PaymentRulesInfo();
	String rules_select=ti_paymentruleInfo.getSelectString(voucher_type);
	
	String user_id="";
 	if(session.getAttribute("session_user_id")!=null){
	     user_id  =session.getAttribute("session_user_id").toString();
	}
  %>
	
	<h1>修改优惠券管理</h1>

	<form action="/doTradeReg.do" method="post" name="updateForm">
	<table width="100%" cellpadding="0" cellspacing="1" border="0" class="listtab">
		
		<tr>
			<td align="right" width="10%">
				优惠券类型<font color="red">*</font>
			</td>
			<td>
			<select name="voucher_type" id="voucher_type" >
								  	<%=rules_select%>
			</select>
			</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				优惠券名称<font color="red">*</font>
			</td>
			<td><input name="voucher_name" id="voucher_name" size="20" maxlength="20" value="<%=voucher_name %>" type="text" /></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				使用规则<font color="red">*</font>
			</td>
			<td>
			<select name="usage_rules" id="usage_rules" >
				<option value="1" <%if(usage_rules.equals("1"))out.print("selected='selected'"); %>>满额使用</option>
				<option value="2" <%if(usage_rules.equals("2"))out.print("selected='selected'"); %>>满量使用</option>
				<option value="3" <%if(usage_rules.equals("3"))out.print("selected='selected'"); %>>无条件</option>
			</select>
			</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				开始时间<font color="red">*</font>
			</td>
			<td><input name="start_time" id="start_time" size="20" maxlength="20" value="<%=start_time %>" type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'end_time\')}',minDate:'%y-%M-%d',readOnly:true})"/></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				结束时间<font color="red">*</font>
			</td>
			<td><input name="end_time" id="end_time" size="20" maxlength="20" value="<%=end_time %>" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'start_time\',{d:+1})}',readOnly:true})"/></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				金额<font color="red">*</font>
			</td>
			<td><input name="money" id="money" size="5" maxlength="5" value="<%=money %>" type="text" /></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				财产类型<font color="red">*</font>
			</td>
			<td>
			<select name="property_type" id="property_type" >
									<option value="1"  >人民币</option>
									<option value="2" >积分</option>
						</select>
			</td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				当前状态<font color="red">*</font>
			</td>
			<td>
			<select name="state_code" id="state_code" >
									<option value="0" <%if(state_code.equals("0"))out.print("selected='selected'"); %>>生成</option>
									<option value="1" <%if(state_code.equals("1"))out.print("selected='selected'"); %>>领用</option>
									<option value="2" <%if(state_code.equals("2"))out.print("selected='selected'"); %>>作废</option>
						</select>
			</td>
		</tr>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td align="center">
				<input type="hidden" name="bpm_id" value="9016" />
	  			<input type="hidden" name="voucher_id" value="<%=voucher_id %>" />
	  			<input name="user_id" id="user_id" value="<%=user_id %>" type="hidden" />
				<input type="button" class="buttoncss" name="tradeSub" value="提交" onclick="return checkSub('updateForm');"/>&nbsp;&nbsp;
				<input type="button" class="buttoncss" name="tradeRut" value="返回" onclick="window.location.href='index.jsp';"/>
			</td>
		</tr>
	</table>
	</form>
</body>

</html>

